ci: add simulator-init regression coverage for #4850#4861
Merged
shai-almog merged 2 commits intomasterfrom May 4, 2026
Merged
Conversation
Issue #4850 (StringIndexOutOfBoundsException out of parseTextFieldInputMode) shipped to end users despite cn1app-archetype-test.sh exercising cn1:css on every PR-merge. Root cause of the coverage miss: JavaSEPort.enableAutoLocalizationBundle is gated on the per-user preference cn1.autoDefaultResourceBundle, which CI runners default to false but real users have stuck to true via the simulator menu. The forked CN1CSSCLI took the gated branch on user machines and not in CI for six months. Three coverage additions, no production-code changes: - tests/core/.../AutoLocalizationBundleTest.java: smoke-test the full simulator-init handoff (AutoLocalizationBundle for an empty l10n dir, installed via UIManager.setBundle) end-to-end. Catches the @-meta-key echo regression and any future setBundle/parseTextFieldInputMode break regardless of preference state. - maven/integration-tests/inc/auto-bundle-pref.sh: helper that flips the Preferences.userRoot node Maven's forked CSS subprocess reads. Used by cn1app-archetype-test.sh to force the user-side branch on for the duration of the build, then unconditionally restore via trap. - .github/workflows/archetype-smoke.yml: PR-time, path-gated job that generates an archetype project, installs xvfb, and runs the smoke test with the pref forced on. Previously this end-to-end exercise only ran on push/PR to master via ant.yml. Also surfaces a pre-existing skip: android-native-interface-test.sh started with bare `exit 0` ("Failing for some reason... need to investigate, but will do it later"), masquerading as green in all.sh's set -e cascade. Added an explicit [SKIP] log line so the disablement is visible in suite output. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
Author
|
Compared 86 screenshots: 86 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
Benchmark ResultsDetailed Performance Metrics
|
Collaborator
Author
|
Compared 82 screenshots: 82 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
ThomasH99 reports the same `parseTextFieldInputMode` crash on 7.0.237 even with the @-key fabrication guard from `ba8044ef0` in place. Root cause: the ba8044e fix only blocks NEW echoes for missing @-prefixed keys; it does nothing for keys that older Codename One versions already echoed AND persisted to disk. Existing user projects whose Bundle.properties contains `@im=@im` and `@im-@im=@im-@im` from a prior simulator boot bypass the @-prefix null-guard because `super.get` returns the persisted real value, not null. setBundle then tokenizes "@im" -> ["@im"], looks up "@im-@im", gets back the persisted "@im-@im", and crashes inside `parseTextFieldInputMode("@im-@im")` on `substring(0, indexOf('='))` for a token with no `=`. Self-heal at load time: - AutoLocalizationBundle.loadFromFile drops entries where the key starts with `@` and the value equals the key (the wormhole signature). The in-memory Hashtable never sees them, and the file is rewritten without them so the corruption clears permanently on the next boot. - The check is intentionally narrow: only `@k=@k` self-references match. Legitimate meta-key data like `@rtl=true` or `@im=ABC|abc` flows through unchanged. Non-meta keys keep their normal "missing-translation echo" behavior because that's an intended developer aid. Test: - AutoLocalizationBundleTest.verifySetBundleHealsLegacyWormholeFile pre-populates a legacy Bundle.properties with `@im=@im`, `@im-@im=@im-@im`, `@rtl=@rtl`, plus a non-wormhole `hello=world`. After construction the Hashtable returns null for the three @-keys, the file no longer contains them, and the non-wormhole entry survives both in memory and on disk. UIManager.setBundle on the bundle no longer crashes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Compared 7 screenshots: 7 matched. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
parseTextFieldInputModeduring the forkedcn1:csssubprocess on every initializr/archetype project for users with the auto-update bundle pref toggled on).cn1app-archetype-test.shandtests/core.shboth invokecn1:css, butJavaSEPort.enableAutoLocalizationBundleis gated on the per-user preferencecn1.autoDefaultResourceBundle(default false). CI runners don't have the pref set; users with the simulator menu toggled at any point in CN1 history do. The bug was deterministic on user machines and silently bypassed in CI for ~6 months.ba8044ef0/2d1e1f83c.What's in this PR
tests/core/test/com/codename1/impl/javase/AutoLocalizationBundleTest.java— extended withverifySetBundleSmokeOnFreshProject, which constructs anAutoLocalizationBundleagainst an emptysrc/main/l10n(matchingenableAutoLocalizationBundle) and hands it toUIManager.setBundle. Pre-fix this throws insideparseTextFieldInputMode; post-fix it installs cleanly. Catches both the@-key fabrication regression and any futuresetBundlebreak, independent of preference state.maven/integration-tests/inc/auto-bundle-pref.sh— helper that flips thePreferences.userRoot()nodecn1:css's forked JVM reads. Used bycn1app-archetype-test.shto force-on the gated branch for the duration of the build. The pref persists via~/.java/.userPrefs, so the parent-process flush is visible to forked Maven plugin subprocesses..github/workflows/archetype-smoke.yml— new path-gated PR job that generates an archetype project, installs xvfb, and runs the smoke. Previously the only end-to-end archetype build wasant.yml'sbash all.sh, which runs only on push/PR to master and was the workflow that missed this regression.Drive-by
maven/integration-tests/android-native-interface-test.shstarted with bareexit 0("Failing for some reason... need to investigate, but will do it later"), so underall.sh'sset -eit masqueraded as a green check. Added an explicit[SKIP]log line so the disablement shows up in suite output instead of pretending to pass.Test plan
archetype-smoke.ymlruns on this PR (path filter matches the modified files).archetype-smoke.yml, theRun archetype simulator smoke (auto-bundle pref forced on)step succeeds — meaning the forked CN1CSSCLI took theenableAutoLocalizationBundlebranch and didn't crash.ant.yml'sbash tests/all.shcontinues to pass with the extendedAutoLocalizationBundleTest.set_auto_bundle_pref truesets the pref and a separatejavainvocation reads it back as true (validated locally; included for reviewer reference).🤖 Generated with Claude Code